{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "from sklearn import datasets, linear_model,discriminant_analysis,cross_validation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 加载数据方法，这里使用scikit-learn自带的鸢尾花分类数据\n",
    "def load_data():\n",
    "    iris = datasets.load_iris()\n",
    "    # stratify参数将按照分类比例进行拆分数据\n",
    "    return cross_validation.train_test_split(iris.data, iris.target,test_size=0.25,random_state=0,stratify=iris.target)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 逻辑回归模型\n",
    "def test_LogisticRegression(*data):\n",
    "    train_x,test_x, train_y, test_y = data\n",
    "    regr = linear_model.LogisticRegression()\n",
    "    regr.fit(train_x, train_y)\n",
    "    \n",
    "    # y=wx+b  分别显示权重及b值\n",
    "    print('【权重】coefficient:{0}'.format(regr.coef_))\n",
    "    print('【b值】intercept: {0}'.format(regr.intercept_))\n",
    "    # 均方差\n",
    "    print('【均方差】residual sum of squares:{0}'.format(np.mean((regr.predict(test_x) -test_y)**2)))\n",
    "    # 成绩\n",
    "    print('【成绩】Testing Score: {0}'.format(regr.score(test_x,test_y)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "【权重】coefficient:[[ 0.39310895  1.35470406 -2.12308303 -0.96477916]\n",
      " [ 0.22462128 -1.34888898  0.60067997 -1.24122398]\n",
      " [-1.50918214 -1.29436177  2.14150484  2.2961458 ]]\n",
      "【b值】intercept: [ 0.24122458  1.13775782 -1.09418724]\n",
      "【均方差】residual sum of squares:0.02631578947368421\n",
      "【成绩】Testing Score: 0.9736842105263158\n"
     ]
    }
   ],
   "source": [
    "# 测试\n",
    "train_x,test_x, train_y, test_y = load_data()\n",
    "test_LogisticRegression(train_x, test_x, train_y, test_y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 逻辑回归模型 multinomial 多类分类策略\n",
    "def test_LogisticRegression_multinomial(*data):\n",
    "    train_x,test_x, train_y, test_y = data\n",
    "    regr = linear_model.LogisticRegression(multi_class='multinomial',solver='lbfgs')\n",
    "    regr.fit(train_x, train_y)\n",
    "    \n",
    "    # y=wx+b  分别显示权重及b值\n",
    "    print('【权重】coefficient:{0}'.format(regr.coef_))\n",
    "    print('【b值】intercept: {0}'.format(regr.intercept_))\n",
    "    # 均方差\n",
    "    print('【均方差】residual sum of squares:{0}'.format(np.mean((regr.predict(test_x) -test_y)**2)))\n",
    "    # 成绩\n",
    "    print('【成绩】Testing Score: {0}'.format(regr.score(test_x,test_y)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "【权重】coefficient:[[-0.38413369  0.85418523 -2.27223622 -0.98531286]\n",
      " [ 0.34404755 -0.37365092 -0.03070324 -0.86072926]\n",
      " [ 0.04008614 -0.48053431  2.30293946  1.84604212]]\n",
      "【b值】intercept: [  8.80503216   2.46636227 -11.27139443]\n",
      "【均方差】residual sum of squares:0.0\n",
      "【成绩】Testing Score: 1.0\n"
     ]
    }
   ],
   "source": [
    "# 测试\n",
    "train_x,test_x, train_y, test_y = load_data()\n",
    "test_LogisticRegression_multinomial(train_x, test_x, train_y, test_y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 逻辑回归模型 参数C对结果的影响\n",
    "def test_LogisticRegression_C(*data):\n",
    "    train_x,test_x, train_y, test_y = data\n",
    "    Cs = np.logspace(-2,4,num=100)\n",
    "    test_score = []\n",
    "    for C in Cs:\n",
    "#         regr = linear_model.LogisticRegression(multi_class='multinomial',solver='lbfgs',C=C)?\n",
    "        regr = linear_model.LogisticRegression(C=C)\n",
    "        regr.fit(train_x,train_y)\n",
    "        test_score.append(regr.score(test_x,test_y))\n",
    "        \n",
    "    # 绘图：\n",
    "    fig = plt.figure()\n",
    "    ax = fig.add_subplot(111)\n",
    "    ax.plot(Cs,test_score, label='Testing Score')\n",
    "    ax.set_xlabel(r'C')\n",
    "    ax.set_ylabel(r'score')\n",
    "    ax.set_title('LogisticRegression')\n",
    "    ax.set_xscale('log')\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEaCAYAAADg2nttAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3X2YnHV97/H3J5vnZDcJZEMeSQIEyPpQ0AitnFZsFSOnFbStBjkerQq1l3ha29pCq2CxHrk8Wk89xWpoucCeozSl1qan6QEtUlvFNosCmlkCSUCT7EI2Icns5mE3u/s9f8w9YbLs7szszr0zs/N5Xddcmbkfv7+dzHzmvn/3gyICMzOzsUyrdgFmZlb7HBZmZlaUw8LMzIpyWJiZWVEOCzMzK8phYWZmRTksbMqSdL2kB8c57w5JV1a4pJoj6YuSPlbtOqz2yedZWK2Q9Czw/oj45iSv9x5gX0R8dBzzBnAcCOAo8NfARyJisKJFmlWZtyzMJu6nImI+8DrgHcB7K70C5fjzalXj/3xW8yTdIGmXpBckbZW0vGDcVZJ2Sjoq6QuS/kXS+5Nx75H0b8lzSfqcpAOSspJ+KOnlkm4Ergd+T1KvpH9Ipn9W0huS502S/kDSbkk9kh6VtGp4nRGxC/gOcElBfQsk/aWkLkn7Jf2xpKaC5X5W0kFJz0i6SVJImp6Mf1jSJyV9h9zWy3l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ju7gJGK1dXwN+WdKfU7lLNqRtxLbU0XuRN9p7Usufj9GM9p5cKenzkr4EbKtOaWUbsS0R8YcR8VvkAu+uiQYFVP9OeTUvIj4PfL7adVRCRBwit2+5LkXEMeDXql1HJdT7e5E3xT4fD5O70dqUERH3VGpZjbhlUcod/OrFVGpLoanUrqnSlqnSDnBbxqURw6KUO/jVi6nUlkJTqV1TpS1TpR3gtoxPtXv4Uz564KtAF3CK3L689yXDryZ3v+/dwB9Wu85Ga8tUbddUactUaYfbUtmHLyRoZmZFNeJuKDMzK5PDwszMinJYmJlZUQ4LMzMrymFhZmZFOSzMzKwoh4VZiiQtlXSfpN2SHpW0TdKF1a7LrFy+NpRZSpIrFv8dcG9EbEqG/RRwDrmTqMzqhsPCLD2vB05FxBfzAyLi8SrWYzZu3g1llp6XA49WuwizSnBYmJlZUQ4Ls/TsAF5d7SLMKsFhYZaeh4BZkm7MD5D0Skk/W8WazMbFYWGWkshd0vmtwBuSQ2d3AJ8CnqtuZWbl8yXKzcysKG9ZmJlZUQ4LMzMrymFhZmZFOSzMzKwoh4WZmRXlsDAzs6IcFmZmVpTDwszMivr/unzGoSL1d7QAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 进行测试\n",
    "train_x,test_x, train_y, test_y = load_data()\n",
    "test_LogisticRegression_C(train_x, test_x, train_y, test_y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
